/*
  Segment Pin      Arduino Pin
  1                2
  2                8
  4                GND
  6                3
  7                4
  8                5
  9                Not Connected
  12               GND
  13               6
  14               7
  
  I used that pin out and the following sketch to achieve a timer that counted from 0-9
  Connect a resistor to each ground or you'll burn out the LED's. I used a 1.2k ohm +/- 5%
  (Brown,Red, Red, Gold) for this because it's what I had laying around.
*/

#define ZERO	{1,1,1,1,1,1,0} 
#define ONE	{0,0,0,1,1,0,0}
#define TWO	{0,1,1,0,1,1,1}
#define THREE	{0,0,1,1,1,1,1}
#define FOUR	{1,0,0,1,1,0,1}
#define FIVE	{1,0,1,1,0,1,1}
#define SIX	{1,1,1,1,0,1,1}
#define SEVEN	{0,0,0,1,1,1,0}
#define EIGHT	{1,1,1,1,1,1,1}
#define NINE	{1,0,1,1,1,1,1}

const byte digits[10][7] =
{
  ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE
};

void setup(){
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
}

void writeDigit(byte digit){
  byte pin = 2;
  for (byte segCount = 0; segCount < 7;++segCount){
    digitalWrite(pin,digits[digit][segCount]);
    pin++;
  }
}
void loop(){
  for(int i=0;i<10;i++){
    writeDigit(i);
    delay(1000);
  }
}
